from pydantic import BaseModel
from typing import Optional
from datetime import datetime

class FurnitureBase(BaseModel):
    name: Optional[str] = None
    price: Optional[float] = None
    img: Optional[str] = None
    describe: Optional[str] = None
    stock: Optional[int] = 0
    ison: Optional[bool] = True
    brand: Optional[str] = None
    description: Optional[str] = None
    category: Optional[str] = None

class FurnitureCreate(FurnitureBase):
    pass

class FurnitureUpdate(BaseModel):
    name: Optional[str] = None
    price: Optional[float] = None
    img: Optional[str] = None
    describe: Optional[str] = None
    stock: Optional[int] = None
    ison: Optional[bool] = None
    brand: Optional[str] = None
    description: Optional[str] = None
    category: Optional[str] = None

class Furniture(FurnitureBase):
    id: int
    created_at: Optional[datetime] = None
    
    class Config:
        from_attributes = True
